package slistmgr

import (
	"gameserver/server/Login/internal"

	"gitee.com/night-tc/gobige/global"
	"gitee.com/night-tc/gobige/logger"
)

/*
服务器列表
*/

var (
	slimgr *ServerListMgr
)

func GetSliMgr() *ServerListMgr {
	return slimgr
}

// 返回-1表示没有对应的服务器实例开着
func getLoadByGroup(gid uint32) (result int64) {
	li, err := internal.GetSrvinst().GetDirMgr().GetServerList(global.ServerTypeGateway, gid)
	if err != nil {
		logger.Warnf("getLoadByGroup:%s", err)
		return -1
	}
	for _, v := range li {
		result += v.GetLoad()
	}
	return result
}
